#include <boost/interprocess/ipc/message_queue.hpp>
#include <iostream>
#include <vector>
#include <string>

using namespace std ;
using namespace boost::interprocess;

const int BUFFER_SIZE = 256 ;
int main ()
{
    char buffer[BUFFER_SIZE] ;
    try{
        //Erase previous message queue
        message_queue::remove("message_queue");

        //Create a message_queue.
        message_queue mq
            (create_only               //only create
             ,"message_queue"           //name
             ,100                       //max message number
             ,BUFFER_SIZE               //max message size
            );

        sprintf(buffer, "%d", 100) ;
        mq.send(buffer, strlen(buffer), 0);
        sprintf(buffer, "%d", 200) ;
        mq.send(buffer, strlen(buffer), 0);
        sprintf(buffer, "%d", 300) ;
        mq.send(buffer, strlen(buffer), 0);
    }

    catch(interprocess_exception &ex){
        std::cout << ex.what() << std::endl;
        return 1;
    }

    return 0;
}

